

const { colorOption } = getApp().globalData;
Component({
  /**
   * 组件的属性列表
   */
  properties: {},

  /**
   * 组件的初始数据
   */
  data: {
    list: [
      {
        pagePath: "/pages/index/index",
        text: "首页",
        iconPath: "../images/navIcon/home1.png",
        selectedIconPath: "../images/navIcon/home2.png",
      },
      {
        pagePath: "/pages/corner/index",
        text: "相亲角",
        iconPath: "../images/navIcon/heart1.png",
        selectedIconPath: "../images/navIcon/heart2.png",
      },
      {
        pagePath: "/pages/mine/index",
        text: "我的",
        iconPath: "../images/navIcon/mine1.png",
        selectedIconPath: "../images/navIcon/mine2.png",
      },
    ],
    selected: 0,
    visible: true,
    color: colorOption.greyNavColor,
    selectedColor: colorOption.mainColor,
  },
  /**
   * 组件的方法列表
   */
  methods: {
    // 切换导航
    switchTab(e) {
      const { path: url } = e.currentTarget.dataset;
      wx.switchTab({
        url,
      });
    },
    // 设置当前选中项
    setSelected(index) {
      this.setData({
        selected: index,
      });
    },
    // 设置是否显示
    setVisible(visible) {
      this.setData({
        visible: visible,
      });
    },
  },
});
